home *** CD-ROM | disk | FTP | other *** search
- ' Calling an Excel dialog from VB
- ' 1. create an Excel workbook called SHEETS.XLS
- ' 2. open a dialog sheet
- ' 3. add a listbox
-
- Dim APPXL As object
- Dim XL As object
- Dim wb As object
- Dim dlg As object
- Dim dlgList As object
- Dim objList As object
-
- Set APPXL = GetObject(, "Excel.Application")
- Set XL = APPXL.Application
- XL.Workbooks.Open "SHEETS.XLS"
- Set wb = XL.ActiveWorkbook
- Set Dlg = wb.DialogSheets("dialog1")
- Set DlgList = dlg.ListBoxes("sheetsList")
- Set objList = wb.Sheets
- dlgList.RemoveAllItems
- dlg.DialogFrame.Caption = "List of Sheets"
- For ix = 1 To objList.count
- dlgList.[AddItem] (objList(ix).name)
- Next
- dlg.[Show]
-
- Set dlg = Nothing
- Set dlgList = Nothing
- Set objList = Nothing
- Set wb = Nothing
- Set XL = Nothing
- Set APPXL = Nothing
-